<div class="">
	<h1>Stock Darah <small></small></h1>
</div>

<?php
//echo '<pre>';
//print_r($stock);
//echo '</pre>';
?>

<div class="btn-toolbar">
    <div class="col-sm-3 ">
		<select name="id_nationality" class=" form-control">
			<option value=""></option>
			<?php foreach ($udd as $key => $u) { ?>
				<option <?php echo ($u['id_udd']==$selected)?' selected="selected" ':"";?> value="<?php echo $u['id_udd']; ?>"><?php echo $u['udd']; ?></option>
			<?php } ?>
			
		</select>
	</div>
</div>
</br>
<div class="container">
	<div class="row col-md-10 custyle">
		<table class="table table-bordered table-striped  custab ">
			<thead>
				<tr>
					<th class="col-md-2"></th>
					<th colspan="3"><center>A</center></th>
					<th colspan="3"><center>B</center></th>
					<th colspan="3"><center>AB</center></th>
					<th colspan="3"><center>O</center></th>
					<th></th>
				</tr>
				<tr>
					<th>Datetime</th>
					<th>WB</th>
					<th>PRC</th>
					<th>TC</th>
					<th>WB</th>
					<th>PRC</th>
					<th>TC</th>
					<th>WB</th>
					<th>PRC</th>
					<th>TC</th>
					<th>WB</th>
					<th>PRC</th>
					<th>TC</th>
					<th><center>Act</center></th>
				</tr>
			</thead>
			
			<tr>
				<form method="post" action="<?php echo base_url() . 'index.php/main/dotambahstock'; ?>">
					<td></td>
				<input type="hidden" name='id_udd' value="<?php echo $selected; ?>"/>
				<td><input type="text" name='a_wb'  placeholder='WB' class="tbintable"/></td>
				<td><input type="text" name='a_prc'  placeholder='PRC' class="tbintable"/></td>
				<td><input type="text" name='a_tc'  placeholder='TC' class="tbintable"/></td>
				<td><input type="text" name='b_wb'  placeholder='WB' class="tbintable"/></td>
				<td><input type="text" name='b_prc'  placeholder='PRC' class="tbintable"/></td>
				<td><input type="text" name='b_tc'  placeholder='TC' class="tbintable"/></td>
				<td><input type="text" name='ab_wb'  placeholder='WB' class="tbintable"/></td>
				<td><input type="text" name='ab_prc'  placeholder='PRC' class="tbintable"/></td>
				<td><input type="text" name='ab_tc'  placeholder='TC' class="tbintable"/></td>
				<td><input type="text" name='o_wb'  placeholder='WB' class="tbintable"/></td>
				<td><input type="text" name='o_prc'  placeholder='PRC' class="tbintable"/></td>
				<td><input type="text" name='o_tc'  placeholder='TC' class="tbintable"/></td>
				<td> <button class='btn btn-info btn-xs' type="submit"><span class="glyphicon glyphicon-plus"></span></button> </td>
					
				</form>
				
			</tr>
			<?php foreach ($stock as $key => $s) { ?>
				
			<tr>
				<td><?php echo $s['datetime_created']; ?></td>
				<td><?php echo $s['a_wb']; ?></td>
				<td><?php echo $s['a_prc']; ?></td>
				<td><?php echo $s['a_tc']; ?></td>
				<td><?php echo $s['b_wb']; ?></td>
				<td><?php echo $s['b_prc']; ?></td>
				<td><?php echo $s['b_tc']; ?></td>
				<td><?php echo $s['ab_wb']; ?></td>
				<td><?php echo $s['ab_prc']; ?></td>
				<td><?php echo $s['ab_tc']; ?></td>
				<td><?php echo $s['o_wb']; ?></td>
				<td><?php echo $s['o_prc']; ?></td>
				<td><?php echo $s['o_tc']; ?></td>
				<td><a class='btn btn-danger btn-xs' href="<?php echo base_url() . 'index.php/main/dohapusstock/' . $s['id_stock']; ?>"><span class="glyphicon glyphicon-minus"></span></a></td>
			</tr>
			<?php } ?>
		</table>
		<a class="pull-right" href="#">More</a>
	</div>
</div>
<script type="text/javascript">
		$('select').on('change', function() {
		window.location = "<?php echo base_url(); ?>index.php/main/stock/"+this.value;
	}); 
</script>
